import { z } from "zod";

// 基础信息项
const basicInfoItemSchema = z.object({
  label: z.string(),
  val: z.string(),
});

// 教育经历项
const educationItemSchema = z.object({
  school: z.string(),
  time: z.string(),
  program: z.string(),
  content: z.array(z.string()),
});

// 工作经历项
const experienceItemSchema = z.object({
  company: z.string(),
  time: z.string(),
  role: z.string(),
  content: z.array(z.string()),
});

// 外部内容项
const externalItemSchema = z.object({
  title: z.string(),
  content: z.array(z.string()),
});

// 简历表单schema
export const resumeFormSchema = z.object({
  avatar: z.string().optional(),
  title: z.string().optional(),
  primary: z.string().optional(),
  secondary: z.string().optional(),
  basicInfo: z.object({
    title: z.string(),
    data: z.array(basicInfoItemSchema),
  }),
  education: z.object({
    title: z.string(),
    data: z.array(educationItemSchema),
  }),
  experience: z.object({
    title: z.string(),
    data: z.array(experienceItemSchema),
  }),
  externals: z.array(externalItemSchema),
});

export type Resume = z.infer<typeof resumeFormSchema>;
